#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
int main()
{
	int number, a;
	void f(int);
	scanf("%d", &number);
	f(number);
	putchar('\n');
	return 0;
}
void f(int number)
{
	int a, i, b[3];
	for (i = 101; i <= number; i++)
	{
		a = sqrt(i);
		if (a * a != i)
			continue;

		b[0] = i / 100;
		b[1] = i / 10 % 10;
		b[2] = i % 10;
		if (b[0] == b[1] || b[1] == b[2] || b[0] == b[2])
			printf("%d ", i);
	}
}